<%@ page language="java" import="java.util.*,njust.domain.*,njust.dao.impl.*,java.util.List" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%

/*
	List<Goods> li=(List<Goods>)request.getAttribute("goods");
	for(int i=0;i<li.size();i++){
		Goods good=(Goods)li.get(i);
		out.println("<span>"+good.getGoodname()+"</span>");
	}
	*/
%>



<!DOCTYPE html>
<html lang="en">


<head>
    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <script src="./jquery.js"></script>
    <link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="./bootstrap/css/bootstrap-theme.min.css">
    <script src="./bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" type="text/css" href="./css/theme.css">
    <link rel="stylesheet" href="./font-awesome/css/font-awesome.css">
    <link rel="stylesheet" href="./css/style.css">
    
 	<script>
        window.onload = function () {
            $(".goods").click(function () {
                $(this).attr("class", "active goods");
                $(".needs").attr("class", "needs");
            });
            $(".needs").click(function () {
                $(this).attr("class", "active needs");
                $(".goods").attr("class", "goods");
            });

        }
    </script>
</head>


<body>
	
	 <div class="ue-bar" style="position: fixed;width:100%;z-index:100">
		<div class="ue-bar-warp">
			<div class="ue-bar-logo">
				<a href="#"> <img src="./img/logo.png" width="200px"
					alt="大学生交易平台" title="大学生交易平台">
				</a>
			</div>
			<div class="ue-bar-nav">
				<ul>
					<li><a href="home.jsp">首页</a></li>
					<li><a href="goods!getAllGoodsByTime.action">所有闲置</a></li>
					<li><a href="needs!getPageNeeds.action">所有需求</a></li>
					<li class="active"><a href="goods!getGoodByUserId.action">个人中心<span class="badge"
							style="background:green;margin-left:5px;">1</span></a></li>
				</ul>
				<form class="search" action="goods!SearchGood.action">
					<div class="search_input">
						<input type="text" name ="searchkeywords" class="form-control" placeholder="请输入关键字"/>
					</div>
					<button type="submit" class="btn btn-default">搜索</button>
				</form>
			</div>


			<div class="login">

				<c:choose>
					<c:when test="${empty sessionScope.user}">
						<a href="#" data-toggle="modal" data-target="#myModal">登录</a>
						<a href="#" data-toggle="modal" data-target="#myModal1">注册</a>
					</c:when>
					<c:otherwise>
						<a href="#">欢迎你，${sessionScope.user.username }</a>
						<a href="user!logout.action">注销</a>
					</c:otherwise>
				</c:choose>

			</div>


		</div>
	</div>
	<!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">登录您的账号</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" action="user!login.action">
						<div class="form-group">
							<label for="inputEmail3" class="col-sm-2 control-label">账号</label>
							<div class="col-sm-9">
								<input name="user.username" class="form-control"
									id="inputEmail3" placeholder="请输入您的账号" required>
							</div>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
							<div class="col-sm-9">
								<input type="password" name="user.password" class="form-control"
									id="inputPassword3" placeholder="请输入您的密码" required>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-8">
								<button type="submit" class="btn btn-primary btn-lg btn-block">登录</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- Modal -->
	<div class="modal fade" id="myModal1" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">注册您的账号</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" action="user!addUser.action">
						<div class="form-group">
							<label for="inputEmail3" class="col-sm-2 control-label">账号</label>
							<div class="col-sm-9">
								<input name="user.username" class="form-control"
									id="inputEmail3" placeholder="请输入您的账号" required>
							</div>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
							<div class="col-sm-9">
								<input type="password" name="user.password" class="form-control"
									id="inputPassword3" placeholder="请输入您的密码" required>
							</div>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">确认密码</label>
							<div class="col-sm-9">
								<input type="password" class="form-control" id="inputPassword3"
									placeholder="请确认您的密码" required>
							</div>
						</div>

						<div class="form-group">
							<label for="inputPhonenumber" class="col-sm-2 control-label">手机</label>
							<div class="col-sm-9">
								<input name="user.phonenumber" class="form-control"
									id="inputEmail3" placeholder="请输入您的手机号码">
							</div>
						</div>

						<div class="form-group">
							<label for="inputQQ" class="col-sm-2 control-label">QQ</label>
							<div class="col-sm-9">
								<input name="user.qq" class="form-control" id="inputEmail3"
									placeholder="请输入您的qq号">
							</div>
						</div>

						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">性别</label>
							<div class="col-sm-9">
								<input type="radio" name="user.sex" value="男">男 <input
									type="radio" name="user.sex" value="女">女
							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-8">
								<button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>



    <div class="container-fluid">

        <div class="row-fluid">
            <div class="col-md-3" style="position:fixed;margin-top:30px">
                <div class="sidebar-nav">

                    <ul id="dashboard-menu" class="nav nav-list collapse in">
                        <li class="active goods"><a href="#ggoods">我的商品</a></li>
                        <li class="needs"><a href="#nneeds">我的需求</a></li>


                    </ul>
                </div>
            </div>


            <div class="col-md-offset-3 col-md-9" style="margin-top:30px;">
                <div class="row-fluid">
                    <div class="block span10">
                        <div class="block-heading" data-toggle="collapse" data-target="#tablewidget" id="ggoods">我的商品</div>
                        <div id="tablewidget" class="block-body collapse in">
                            <table class="table">
                                <tbody>
                                
                                
                                
                                	
                                
                                	<c:forEach items="${goods}" var="good">
                                
                                	
                                    <tr>
                                        <td>
                                        	<a href="goods!getGoodById.action?id=${good.id}">
                                            <img src='${good.url }' class="img-polaroid" style="width:100px;height:100px;">
                                        	</a>
                                        </td>
                                        <td>
                                            <p class="title"><a href="goods!getGoodById.action?id=${good.id}">${good.goodname }</a></p>
                                            <p class="first">
                                            
                                            <c:choose>
											<c:when test="${good.agingdegree==10 }">全新</c:when>
											<c:when test="${good.agingdegree==9 }">九成新</c:when>
											<c:when test="${good.agingdegree==8 }">八成新</c:when>
											<c:when test="${good.agingdegree==7 }">七成新</c:when>
											<c:when test="${good.agingdegree==6 }">六成新</c:when>
											<c:when test="${good.agingdegree==5 }">五成新</c:when>
											<c:when test="${good.agingdegree==4 }">四城新</c:when>
											<c:when test="${good.agingdegree==3 }">三成新</c:when>
											<c:when test="${good.agingdegree==2 }">两层新</c:when>
											<c:when test="${good.agingdegree==1 }">一层新</c:when>
		
											</c:choose>
                                            
                                            	</p>
                                            <p class="date">发布日期：${good.time }</p>
                                        </td>
                                        <td>
                                            <p class="price">价格，￥${good.price }</p>
                                            <p class="">浏览量：${good.pageview }</p>
                                        </td>
                                        <td>
                                            
                                            <p><a href=""><i class="icon-pencil"></i></a></p>
                                        </td>
                                    </tr>
                                    
                                    </c:forEach>
                                    
                                    
                                    

                                </tbody>
                            </table>
                        </div>
                    </div>




                    <div class="row-fluid">
                        <div class="block span10">
                            <div class="block-heading" data-toggle="collapse" data-target="#widget2container" id="nneeds">我的需求</div>
                            <div id="widget2container" class="block-body collapse in">
                                <table class="table">
                                    <tbody>
                                    
                                    
                                    	<c:forEach items="${needs }" var="needs">
                                    
                                        <tr>
                                            <td style="width: 500px;">
                                                <p class="title"><a href="">${needs.title }</a></p>
                                            </td>
                                            <td>
                                                
                                                <p class="date">发布时间：${needs.time }</p>
                                            </td>
                                            <td>
                                                
                                                <p><a href=""><i class="icon-pencil"></i></a></p>
                                            </td>
                                        </tr>
                                        
                                        </c:forEach>
                                        
                                        
                                       
                                      

                                    </tbody>
                                </table>
                            </div>

                        </div>



                    </div>
                    <br>
                    <br>
                    <br>
                </div>
            </div>


            <footer>
                <hr>


            </footer>





            <script src="js/bootstrap.js"></script>


</body>

</html>